package com.draemon.haixiawenti.util;

/**
 * <p>JVM 工具类</p>
 *
 * @author  yangz
 * @date    2016/10/27
 * @version latest
 */
public class JvmUtil {
    /**
     * 输出字符串异常栈.
     * @return
     */
    public static String printHTMLStackTrace(Throwable t, String division){
        StringBuilder sb = new StringBuilder(1000);
        if(t != null){
            sb.append(t).append(division);
            StackTraceElement[] stacks = t.getStackTrace();
            if(stacks != null){
                for (StackTraceElement stack : stacks){
                    sb.append(stack).append(division);
                }
            }
        }
        return sb.toString();
    }

}
